package com.corpdata.app.message.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.corpdata.core.base.AbstractBaseService;
import com.corpdata.system.security.shiro.util.UserUtil;
import com.corpdata.app.message.dao.SysMessageUserMapper;
import com.corpdata.app.message.entity.SysMessageUser;
import com.corpdata.app.message.service.SysMessageUserService;
import com.corpdata.common.result.Result;

/**
 * 
 * 
 * @author wu
 * @email 64088839@qq.com
 * @date 2018-08-02 10:54:11
 */
@Service
@Transactional
public class SysMessageUserServiceImpl extends AbstractBaseService<SysMessageUser> implements SysMessageUserService {
	@Autowired
	private SysMessageUserMapper muMapper;
	
	//设置为已读
	@Override
	public Result updateMsgRead(String id) {
		SysMessageUser mu = super.findById(id);
		mu.setReadState(true);
		return super.update(mu);
	}
	//设置为删除状态
	@Override
	public Result delById(String id) {
		SysMessageUser mu = super.findById(id);
		mu.setDeleteState(true);
		return super.update(mu);
	}
	@Override
	public int getMsgCount() {
		String userid = UserUtil.getCurrentUserid();
		return muMapper.getMsgCount(userid);
	}
	
}
